import { createRouter, createWebHashHistory } from 'vue-router'

const Home = () => import('@/views/Home/index.vue')
const Layout = () => import('@/views/Layout/index.vue')
const Goods = () => import('@/views/Goods/index.vue')
const Login = () => import('@/views/Login/index.vue')
const Cart = () => import('@/views/Cart/index.vue')
const Settlement = () => import('@/views/Member/settlement/index.vue')
const Pay = () => import('@/views/Member/pay/index.vue')
const Order = () => import('@/views/Member/order/index.vue')
const PayResult = () => import('@/views/Member/pay/result')
const routes = [
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '/',
        component: Home
      }, {
        path: '/goods/:id',
        component: Goods
      }
    ]
  }, {
    path: '/login',
    component: Login
  }, {
    path: '/cart',
    component: Cart
  }, {
    path: '/settlement',
    component: Settlement
  }, {
    path: '/pay',
    component: Pay
  }, {
    path: '/order',
    component: Order
  }, {
    path: '/pay/callback',
    component: PayResult
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior () {
    return { left: 0, top: 0 }
  }
})

export default router
